﻿<?php

// 定义常量，记录网站绝对路径 
define('_ROOT',$_SERVER['DOCUMENT_ROOT']);
// 定义网站地址
$var_local = 'http://localhost';

function checkYear($str)
{
	if (strlen($str)==7)
	{
		$var_y = substr($str, 0, 4);
		$var_m = substr($str, 5, 2);
		$var_year = $var_y.$var_m;
		//echo '<br />pub::checkYear():$var_year='.$var_year.'<br />';
		return $var_year;	
	}
	else if(strlen($str)==12)
	{
		$var_y = substr($str, 0, 6);
		$var_l = substr($str, 6, 1);
		$var_c = substr($str, 7, 1);
		//$var_eid = substr($str, 8, 4);
		
		return $var_y.$var_l.$var_c;
	}
	else
	{
		echo 'pub.php::checkYear() error! '.
		'$str='.$str;	
	}
	
}

function getMark()
{
	$var_year  = checkYear($_REQUEST['year']);
	$var_level = $_REQUEST['level'];
	$var_class = $_REQUEST['class'];
	if (!empty($var_year) and !empty($var_level) and !empty($var_class))
	{
		$var_mark = $var_year.$var_level.$var_class;
		//echo 'pub::getMark():$var_mark='.$var_mark.'<br />';
		return $var_mark;
	}
	else
	{
		echo '$var_year,$var_level,$var_class 可能为空！';	
	}
	
}
 
?>